﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ibba.agil.monitor.proxy;
using Winsoft.Framework.MonitorProxy;

namespace ibba.agil.core.common
{
    public abstract class BusinessFlow
    {
        protected const string _ERROR_BUSINESS = "OCORREU UM ERRO GENERICO NA TRANSAÇÃO DO NEGOCIO";

        private  List<DataTransferIssue> _issues;

      

        
        public List<DataTransferIssue> Issues { 
            get 
            {
                if (_issues == null)
                {
                    _issues = new List<DataTransferIssue>();
                }

                    return _issues;  
            } 
        }
        protected string operation { get; set; }

        protected void LogBusinessIssues()
        {
            _issues.ForEach(i =>
            {
                var monitor = MonitorClientFactory.Create();
                monitor.TraceWarning(new MonitorData
                {
                    TracePoint = 1, 
                    OperationName = operation,
                    TraceMessage = i.Message
                });
            });
        }

        
    }
}
